package com.smart.test;

/**
 * <p><b>Description:</b>  TODO
 * <p><b>Company:</b>
 *
 * @author created by Jesse Xu at 16:40 on 2019/11/20
 * @version V0.1
 * @classNmae Hanoi
 */
public class Hanoi {

    private  int high = 0;

    private int[] A,B,C;


    public Hanoi(int high){
        A = new int[high];
        B = new int[high];
        C = new int[high];
        this.high =high;
        for (int i=0;high>0;high--){
            A[i++]=high;
        }
    }

    private void hanoiMove(int n,char a,char b,char c){
        if(n == 1){
            String move =String.format("%s->%s",a,c);
            System.out.println(move);
            return;
        }
        hanoiMove(n-1,a,c,b);
        String move =String.format("%s->%s",a,c);
        System.out.println(move);
        hanoiMove(n-1,b,a,c);

    }

    public void printA(){
        for (int i:A) {
            System.out.print(i + " ");
        }
    }

    private void printC(){
        for (int i:C) {
            System.out.print(i + " ");
        }
    }

    public static void main(String[] args) {
        Hanoi hanoi = new Hanoi(3);
        hanoi.hanoiMove(3,'A','B','C');
    }


}
